home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection 1998 Fall: Game Toolkit / Disc.iso / SDKs / PCI Driver Development Kit / • Tools / Utility / LogLibrary 950622 / LogDCMDSrc / dcmd_Includes / Dcmd.p < prev    next >
Encoding:
Text File  |  1996-08-20  |  7.6 KB  |  174 lines  |  [TEXT/MPS ]

  1. {    dcmd.p
  2.   This is the dcmd interface.
  3.      Copyright © 1988, 1994 Apple Computer, Inc.  All Rights Reserved.
  4. }
  5.  
  6. UNIT dcmd;
  7.  
  8. INTERFACE
  9.  
  10. {$SETC UsingIncludes := 1}
  11.  
  12. {$IFC UNDEFINED __TYPES__}
  13. {$I Types.p}
  14. {$ENDC}
  15.  
  16. {$IFC UNDEFINED __MACHINEEXCEPTIONS__}
  17. {$I MachineExceptions.p}
  18. {$ENDC}
  19.  
  20.         CONST { Possible requests from the debugger to the command }
  21.                                 dcmdInit                                     = 0;
  22.                                 dcmdDoIt                                     = 1;
  23.                                 dcmdHelp                                     = 2;
  24.                                 { Requests added to MacsBug in 6.5d10 that are only sent to format 3 or newer dcmds }
  25.                                 dcmdSecondaryInit    = 3;    { Second time to init after all System patches have been loaded }
  26.                                 dcmdShutdown                        = 4;    { Dcmd should remove any patches (if possible) }
  27.                                 dcmdGetInfo                            = 5;    { Return dcmd version and pointer to help text }
  28.         
  29.                                 D0Register   = 0;
  30.                                 D1Register   = 1;
  31.                                 D2Register   = 2;
  32.                                 D3Register   = 3;
  33.                                 D4Register   = 4;
  34.                                 D5Register   = 5;
  35.                                 D6Register   = 6;
  36.                                 D7Register   = 7;
  37.  
  38.                                 A0Register   = 8;
  39.                                 A1Register   = 9;
  40.                                 A2Register   = 10;
  41.                                 A3Register   = 11;
  42.                                 A4Register   = 12;
  43.                                 A5Register   = 13;
  44.                                 A6Register   = 14;
  45.                                 A7Register   = 15;
  46.  
  47.                                 PCRegister   = 16;
  48.                                 SRRegister   = 17;        { SR is only 16 bits and is stored in the high word }
  49.         
  50.               freeBlock           = 0;
  51.                                 nonrelocatableBlock = 1;
  52.                                 relocatableBlock    = 2;
  53.  
  54.         TYPE RegFilePtr   = ^RegFile;
  55.                             RegFile      = ARRAY [0..17] OF LONGINT;
  56.         
  57.                             dcmdBlockPtr = ^dcmdBlock;
  58.                             dcmdBlock    = RECORD
  59.                                                                                         registerFile:         RegFilePtr;
  60.                                                                                         request:              INTEGER;
  61.                                                                                         aborted:              BOOLEAN;     { Set to true if the user types a key while scrolling }
  62.                                                                                         macsBugVersion:    LONGINT;                    { version of MacsBug we are running under }
  63.                                                                                         maxCallback:                INTEGER;                    { maximum valid callback we can make }
  64.                                                                                         currentISA:                    CHAR;                                { ISA of current PC }
  65.                                                                                         thePPCException:^ExceptionInformationPowerPC;    { Pointer to PowerPC machine state if ISA is PowerPC }
  66. {                                                                                        thePPCException:PTR;     Pointer to PowerPC machine state if ISA is PowerPC }
  67.                                                                                         requestIOBlock:    PTR;                                    { general-purpose input/output data block pointer }
  68.                                                                                         END;
  69.  
  70.                             GetInfoRequestBlockPtr = ^GetInfoRequestBlock;
  71.                             GetInfoRequestBlock = RECORD
  72.                                                                                         usageStr:             Str255;
  73.                                                                                         creditsStr:     Str255;
  74.                                                                                         dcmdVersion:    NumVersion;
  75.                                                                                         END;
  76.  
  77.   { Pascal declarations for debugger callback routines that can be used by a dcmd }
  78.  
  79.   { Draw the text in the Pascal string as one or more lines separated by CR's.
  80.           Each line causes the MacsBug display to be scrolled and the new line to be
  81.                 drawn at the bottom. If the user types a key while scrolling then the aborted
  82.                 flag is set telling the command to terminate immediately. }
  83.         PROCEDURE dcmdDrawLine (str: Str255);
  84.  
  85.   { Draw the text in the Pascal string as a continuation of the current line.
  86.           CR's are not given special treatment. }
  87.         PROCEDURE dcmdDrawString (str: Str255);
  88.  
  89.   { Draw a given number of characters starting from the given pointer as a 
  90.        continuation of the current line. CR's are not given special treatment. }
  91.   PROCEDURE dcmdDrawText(text: StringPtr; length: INTEGER);
  92.  
  93.   { Scrolls the MacsBug display up one line leaving a blank line at the bottom. }
  94.   PROCEDURE dcmdScroll;
  95.  
  96.   { Display the Pascal string in the command line area and wait for a key to be pressed.
  97.           Return TRUE if the user typed Return. All other keys return FALSE. MacsBug saves this
  98.                 key and adds it to the command line once the current command completes. Typing any
  99.                 key other than Return sets the aborted flag and tells the command to terminate immediately. }
  100.         FUNCTION dcmdDrawPrompt (str: Str255) : BOOLEAN;
  101.  
  102.   { Get the current command line position }
  103.         FUNCTION dcmdGetPosition : INTEGER;
  104.         
  105.         { Set the current command line position. This should only be set to a value returned 
  106.           by dcmdGetPosition. }
  107.         PROCEDURE dcmdSetPosition (pos: INTEGER);
  108.  
  109.   { Return the next character on the command line or CR if the entire line has been scanned }
  110.         FUNCTION dcmdGetNextChar : CHAR;
  111.         
  112.   { Return the next character on the command line or CR if the entire line has been scanned.
  113.           However, the current command line position is not changed. }
  114.         FUNCTION dcmdPeekAtNextChar : CHAR;
  115.         
  116.   { Copy all characters from the command line to the parameter string until a delimiter
  117.           is found or the end of the command line is reached. A delimiter is either a space,
  118.                 a comma or a CR. Both single and double quoted strings are allowed on the command
  119.                 line. However, the leading and trailing quotes must be of the same type. The parameter
  120.                 string is returned without the quotes. This function returns the delimiter }
  121.         FUNCTION dcmdGetNextParameter (VAR str: Str255) : CHAR;
  122.  
  123.   { Parse the command line for the next expression. All expressions are evaluated to 32 bits.
  124.           This function returns the delimiter after the expression. The possible delimiters are
  125.                 space, comma and CR.  Space is    not treated as a delimiter in the middle of expressions.
  126.                 For instance, '1 + 2' will return    a value of 3 and the delimiter will be the char following
  127.                 the 2. The return parameter 'ok' tells if the expression was parsed successfully. }
  128.         FUNCTION dcmdGetNextExpression (VAR value: LONGINT; VAR ok: BOOLEAN) : CHAR;        
  129.  
  130.         { Copy the break message MacsBug displayed the last time it was entered into str.
  131.                 This may contain multiple lines separated by CR's. }
  132.         PROCEDURE dcmdGetBreakMessage  (VAR str: Str255);
  133.         
  134.         { Return a symbolic representation for address in str. If no symbol can be found
  135.                 then an empty string is returned. The format of the symbol returned is Name+0000.
  136.                         With the new compilers, the name is no longer restricted to 8 characters. }
  137.         PROCEDURE dcmdGetNameAndOffset (address: LONGINT; VAR str: Str255);
  138.  
  139.   { Return the trap name for the trap number. If no symbol can be found
  140.                 then an empty string is returned. }
  141.         PROCEDURE dcmdGetTrapName (trapNumber: INTEGER; VAR trapName: Str255);
  142.  
  143.   { Return a pointer the macro name for the given value. If no macro can be found
  144.                 then a nil is returned. }
  145.   FUNCTION dcmdGetMacroName(value: LONGINT): StringPtr;
  146.  
  147.   { When a debugger command is called, the debugger's world (low memory) is installed.
  148.           Commands that want to reference the user's world can swap back and forth between the
  149.                 two worlds by making this call. This procedure does nothing in MacsBug. It is included
  150.                 to support other debuggers that might want to take advantage of it. }
  151.   PROCEDURE dcmdSwapWorlds;
  152.  
  153.   { Toggle between the user and debugger displays.
  154.           The first call restores the user's actual screen.
  155.           The second call restores the debugger's screen. }
  156.         PROCEDURE dcmdSwapScreens;
  157.  
  158.   { Walk thru the blocks in the current heap, calling DoThis for each block. DoThis should
  159.           be a procedure of the form:
  160.                 
  161.             PROCEDURE DoThis (blockAddress, blockLength, addrOfMasterPtr: LONGINT;
  162.                                           blockType: INTEGER;
  163.                               locked, purgeable, resource: BOOLEAN);
  164.  
  165.           The blockAddress and blockLength pertain to the data in the heap block, not including
  166.                 the block header. The addrOfMasterPtr is the master pointer's location in the heap,
  167.                 not the value of the master ptr. The blockType is defined by the constants freeBlock,
  168.                 nonrelocatableBlock and relocatableBlock. The booleans locked, purgeable and resource
  169.                 reflect the state of the block.    }
  170.   PROCEDURE dcmdForAllHeapBlocks (DoThis: ProcPtr);
  171.  
  172. IMPLEMENTATION
  173.  
  174. END.